﻿$(document).ready(function (e) {
    ImgIputHandler.Init();
});
var ImgIputHandler = {
    facePath: [
        { faceName: "微笑", facePath: "微笑.gif" },
        { faceName: "撇嘴", facePath: "撇嘴.gif" },
        { faceName: "色", facePath: "色.gif" },
        { faceName: "发呆", facePath: "发呆.gif" },
        { faceName: "得意", facePath: "得意.gif" },
        { faceName: "流泪", facePath: "流泪.gif" },
        { faceName: "害羞", facePath: "害羞.gif" },
        { faceName: "闭嘴", facePath: "闭嘴.gif" },
        { faceName: "大哭", facePath: "大哭.gif" },
        { faceName: "尴尬", facePath: "尴尬.gif" },
        { faceName: "调皮", facePath: "调皮.gif" },
        { faceName: "龇牙", facePath: "龇牙.gif" },
        { faceName: "惊讶", facePath: "惊讶.gif" },
        { faceName: "难过", facePath: "难过.gif" },
        { faceName: "衰", facePath: "衰.gif" },
        { faceName: "冷汗", facePath: "冷汗.gif" },
        { faceName: "抓狂", facePath: "抓狂.gif" },
        { faceName: "偷笑", facePath: "偷笑.gif" },
        { faceName: "可爱", facePath: "可爱.gif" },
        { faceName: "白眼", facePath: "白眼.gif" },
        { faceName: "傲慢", facePath: "傲慢.gif" },
        { faceName: "惊恐", facePath: "惊恐.gif" },
        { faceName: "流汗", facePath: "流汗.gif" },
        { faceName: "憨笑", facePath: "憨笑.gif" },
        { faceName: "疑问", facePath: "疑问.gif" },
        { faceName: "嘘", facePath: "嘘.gif" },
        { faceName: "折磨", facePath: "折磨.gif" },
        { faceName: "擦汗", facePath: "擦汗.gif" },
        { faceName: "抠鼻", facePath: "抠鼻.gif" },
        { faceName: "鼓掌", facePath: "鼓掌.gif" },
        { faceName: "糗大了", facePath: "糗大了.gif" },
        { faceName: "坏笑", facePath: "坏笑.gif" },
        { faceName: "左哼哼", facePath: "左哼哼.gif" },
        { faceName: "右哼哼", facePath: "右哼哼.gif" },
        { faceName: "哈欠", facePath: "哈欠.gif" },
        { faceName: "委屈", facePath: "委屈.gif" },
        { faceName: "快哭了", facePath: "快哭了.gif" },
        { faceName: "阴险", facePath: "阴险.gif" },
        { faceName: "亲亲", facePath: "亲亲.gif" },
        { faceName: "吓", facePath: "吓.gif" },
        { faceName: "大兵", facePath: "大兵.gif" },
        { faceName: "晚安", facePath: "晚安.gif" },
        { faceName: "早", facePath: "早.gif" },
        { faceName: "炸弹", facePath: "炸弹.gif" },
        { faceName: "骷髅", facePath: "骷髅.gif" },
        { faceName: "猪头", facePath: "猪头.gif" },
        { faceName: "吃饭", facePath: "吃饭.gif" },
        { faceName: "可怜", facePath: "可怜.gif" },
        { faceName: "啤酒", facePath: "啤酒.gif" },
        { faceName: "拥抱", facePath: "拥抱.gif" },
        { faceName: "握手", facePath: "握手.gif" },
        { faceName: "囍", facePath: "囍.gif" },
        { faceName: "菜刀", facePath: "菜刀.gif" },
        { faceName: "加油", facePath: "加油.gif" },
        { faceName: "西瓜", facePath: "西瓜.gif" },
        { faceName: "篮球", facePath: "篮球.gif" },
        { faceName: "乒乓", facePath: "乒乓.gif" },
        { faceName: "玫瑰", facePath: "玫瑰.gif" },
        { faceName: "示爱", facePath: "示爱.gif" },
        { faceName: "握手", facePath: "握手.gif" },
        { faceName: "强", facePath: "强.gif" },
        { faceName: "弱", facePath: "弱.gif" },
        { faceName: "凋谢", facePath: "凋谢.gif" },
        { faceName: "爱情", facePath: "爱情.gif" },
        { faceName: "飞吻", facePath: "飞吻.gif" },
        { faceName: "勾引", facePath: "勾引.gif" },
        { faceName: "OK", facePath: "OK.gif" },
        { faceName: "NO", facePath: "NO.gif" },
        { faceName: "抱拳", facePath: "抱拳.gif" },
        { faceName: "胜利", facePath: "胜利.gif" }
    ]
    ,
    Init: function () {
        var isShowImg = false;
        $("#face").click(function () {
            $(".labiim-chat-face").toggle();
            if (isShowImg == false) {
                isShowImg = true;

                if ($(".labiim-chat-list").children().length == 0) {
                    for (var i = 0; i < ImgIputHandler.facePath.length; i++) {
                        $(".labiim-chat-list").append("<li title=\"" + ImgIputHandler.facePath[i].faceName + "\"><img src=\"images/face/" + ImgIputHandler.facePath[i].facePath + "\" /></li>");
                    }
                    $(".labiim-chat-list>li").click(function () {
                        $(".labiim-chat-face").toggle();
                        isShowImg = false;
                        $(".sendMessage").val($(".sendMessage").val()+"face[" + $(this).attr("title") + "]");
                    });
                }
                    var top = $(this).offset().top- $(".labiim-chat-face").height()-20;
                    console.log(top);
                  $(".labiim-chat-face").css({"top":top});
            } else {
                isShowImg = false;
            }
        }).mouseover(function () {
           // $("#face").click();
        });
    }
}